package com.ferry.example.test;

public class BytesPrintUtil {

		public static final char[] HEXDIGITS = "0123456789abcdef".toCharArray();
		public static String toHexString(byte[] bytes) {
			StringBuilder sb = new StringBuilder(bytes.length * 3);
			sb.append("[");
			for (int b : bytes) {
				b &= 0xff;
				sb.append(HEXDIGITS[b >> 4]);
				sb.append(HEXDIGITS[b & 15]);
				sb.append(',');
			}
			return sb.substring(0,sb.length()-1)+"]";
		}
	}